package com.example.big_event.Utils;

import java.util.HashSet;
import java.util.Random;
import java.util.Set;

public class GenerateUtil {

    static Random r = new Random();
    private static final Set<Integer> set = new HashSet<>();

    /**
     * 生成不重复的七位数
     * @return 返回不重复的七位数
     */
    public static int  GenerateID(){
        int number = 0;
        do{
            number = 1000000+r.nextInt(9000000);
        }while (set.contains(number));
        return number;
    }

}
